home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-01-24 | 3.7 KB | 70 lines | [TEXT/ToyS] |
- -- ••• NOTE: Drop this script file on ResEdit to see the icons used •••
-
- set y to 420
- set iconNo to 200
- set theDialog to {style:standard window, name:"Icon Buttons Demo", size:[576, y + 30], contents:[¬
- {class:push button, bounds:[506, y, 566, y + 20], name:"OK"}, ¬
- {class:check box, bounds:[400, y, 480, y + 20], name:"Enabled", value:true}] ¬
- & MakeGroup(icon push button, "Push Buttons", 20, 30, 22, 22, 200, IFlags(1, 1), 4, 2) ¬
- & MakeGroup(icon radio button, "Radio Buttons", 171, 30, 22, 22, 207, IFlags(1, 1), 4, 2) ¬
- & MakeGroup(icon toggle button, "Toggle Buttons", 321, 30, 22, 22, 214, IFlags(1, 1), 4, 2) ¬
- & MakeGroup(icon sticky button, "Sticky Buttons", 472, 30, 22, 22, 203, IFlags(1, 1), 4, 2) ¬
- & MakeGroup(icon push button, "Big Push Buttons", 20, 110, 40, 40, 200, IFlags(0, 2), 3, 2) ¬
- & MakeGroup(icon radio button, "Big Radio Buttons", 161, 110, 40, 40, 205, IFlags(0, 2), 3, 2) ¬
- & MakeGroup(icon toggle button, "Big Toggle Buttons", 302, 110, 40, 40, 210, IFlags(0, 2), 3, 2) ¬
- & MakeGroup(icon sticky button, "Big Sticky Buttons", 443, 110, 40, 40, 216, IFlags(0, 2), 3, 2) ¬
- & MakeGroup(icon toggle button, "Wide Buttons", 20, 230, 28, 20, 200, IFlags(1, 1), 3, 2) ¬
- & MakeGroup(icon toggle button, "Thin Buttons", 130, 230, 20, 28, 200, IFlags(1, 1), 4, 2) ¬
- & MakeGroup(icon toggle button, "High …", 240, 230, 26, 26, 200, IFlags(1, 3), 2, 2) ¬
- & MakeGroup(icon toggle button, "… Medium …", 320, 230, 22, 22, 200, IFlags(1, 2), 3, 2) ¬
- & MakeGroup(icon toggle button, "… Low …", 413, 230, 20, 20, 200, IFlags(1, 1), 3, 2) ¬
- & MakeGroup(icon toggle button, "… and Flat", 500, 230, 20, 20, 200, IFlags(1, 0), 3, 2) ¬
- & MakeGroup(icon toggle button, "Small Icons on Big Buttons", 20, 320, 40, 40, 200, IFlags(1, 3), 4, 2) ¬
- & MakeGroup(icon toggle button, "Single", 210, 320, 40, 40, 200, IFlags(1, 3), 1, 1) ¬
- & MakeGroup(icon toggle button, "No Icon", 290, 320, 40, 40, -1, IFlags(1, 3), 1, 1) ¬
- & MakeGroup(icon push button, "Changing", 370, 320, 60, 58, iconNo, IFlags(0, 3), 1, 1) ¬
- & MakeGroup(icon toggle button, "Mini-Icons", 470, 320, 20, 20, 200, IFlags(2, 1), 4, 3) ¬
- & [¬
- {class:group box, bounds:[200, 380, 303, 433], name:"Interdependent", enabled:2}, ¬
- {class:icon toggle button, bounds:[210, 400, 232, 422], contents:221, style:IFlags(1, 1), enabled:[dAnd, 2, -139, -140]}, ¬
- {class:icon toggle button, bounds:[240, 400, 262, 422], contents:218, style:IFlags(1, 1), enabled:[dAnd, 2, -138, -140]}, ¬
- {class:icon toggle button, bounds:[270, 400, 292, 422], contents:217, style:IFlags(1, 1), enabled:[dAnd, 2, -138, -139]}, ¬
- {class:static text, bounds:[10, y + 2, 200, y + 20], contents:""} ¬
- ]}
-
- dd install with fonts [null, null, {name:"Geneva", size:9, style:bold}] with grayscale
- set d1 to dd make dialog theDialog
- dd set value of item 14 of d1 to (true)
- dd set value of item 47 of d1 to (true)
- repeat
- set i to dd interact with user
- if i = 1 then
- exit repeat
- else if i = 123 then
- set iconNo to iconNo + 1
- if iconNo > 222 then set iconNo to 200
- dd set contents of item 123 of d1 to iconNo
- end if
- dd set contents of last item of d1 to "Item Pressed: " & i
- end repeat
- --set dVals to dd get value of every item of d1
- dd uninstall
- --dVals
-
- on IFlags(iconSize, border)
- return iconSize + border * 4
- end IFlags
-
- on MakeGroup(ibClass, gName, x, y, w, h, iconID, iStyle, nAcross, nDown)
- set g to [{class:group box, bounds:[x - 10, y - 20, x + (w - 1) * nAcross + 12, y + (h - 1) * nDown + 12], name:gName, enabled:2}]
- repeat nDown times
- set x1 to x
- repeat nAcross times
- set g to g & [{class:ibClass, bounds:[x1, y, x1 + w, y + h], contents:iconID, style:iStyle, enabled:2}]
- set x1 to x1 + w - 1
- set iconID to iconID + 1
- end repeat
- set y to y + h - 1
- end repeat
- return g
- end MakeGroup